﻿using System;

class AnotherNKFacturiel
{
    static void Main()
    {
        //Exercise 5.
        //Write a program that calculates N!*K! / (K-N)! for given N and K (1<N<K).

        // Following Nakov's guidelines in the book the final formula is:  K! / (N+1)

        Console.Write("Enter N (1<N<K):  ");
        decimal n = decimal.Parse(Console.ReadLine());
        Console.Write("Enter K (1<N<K):  ");
        decimal k = decimal.Parse(Console.ReadLine());
        decimal result = 1;

        if (1 < n && n < k)
	    {
            for (int i = 1; i <= k; i++)
            {
                result *= i;
            }
            Console.WriteLine();            
            Console.WriteLine("The result is:  {0}", (result / (n + 1)));
	    }
        else
        {
            Console.WriteLine("The numbers N and K should meet the following prerequisite: 1 < N < K.");
        }
        Console.WriteLine();
    }
}
